package base.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;

public class BsBtnBarTag extends BsContainerTag<Object> {

	private static final long serialVersionUID = 1L;
	
	private String align = "right";
	
	@Override
	public int doStartTag() throws JspException {
		
		StringBuffer tag = new StringBuffer();
		tag.append("<div class=\"btn-toolbar pull-" + align + "\" id='" + name + "' role=\"toolbar\">");
		output(tag);
		
		return Tag.EVAL_PAGE;
	}
	
	@SuppressWarnings("rawtypes")
	@Override
	public int doEndTag() throws JspException {
		
		StringBuffer tag = new StringBuffer();
		tag.append("</div>");
		BsContainerTag parent = (BsContainerTag) this.getParent();
		if(parent != null)
			parent.setToolbar(name);
		output(tag);
		
		return Tag.EVAL_PAGE;
	}

	public String getAlign() {
		return align;
	}

	public void setAlign(String align) {
		this.align = align;
	}

}
